using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace Platform.algorithm
{
    public class BaseUnitFrequencyCompare : IComparer
    {
        int IComparer.Compare(Object x, Object y)
        {
            Element a = (Element)x;
            Element b = (Element)y;
            if (a.Frequency > b.Frequency) return -1;
            else if (a.Frequency == b.Frequency) return 0;
            else return 1;
        }
    }
    public class BaseUnitUseCountCompare : IComparer
    {
        int IComparer.Compare(Object x, Object y)
        {
            int a = KnowledgeBase.Create().GetUnitFrequency((string)x);
            int b = KnowledgeBase.Create().GetUnitFrequency((string)y);
            if (a > b) return -1;
            else if (a == b) return 0;
            else return 1;
        }
    }
    public class BaseCodeCompare : IComparer
    {
        int IComparer.Compare(Object x, Object y)
        {
            Element a = (Element)x;
            Element b = (Element)y;
            return a.SecondCode.CompareTo(b.SecondCode);
        }
    }
}
